package cn.kys.modules.system.repository;

import cn.kys.modules.system.pojo.SubtaskGeom;
import cn.kys.modules.system.pojo.SubtaskPolygon;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface ToolsResposity {
    Map exeSql(@Param("sqlStr") String sqlStr);

    List exeSqlList(@Param("sqlStr") String sqlStr);

    int exeSqlInt(@Param("sqlStr") String sqlStr);

    List exeSqlReturnListInt(@Param("sqlStr") String sqlStr);

    List<Map> queryByDraw(@Param("taskid") Integer taskid, @Param("param1") String param1);

    List<Map> queryByDrawMulti(@Param("taskid") Integer taskid, @Param("param1") String param1);

    Map queryByIdandSubtaskId(@Param("id") Integer id);

    @Select("SELECT name,id FROM  t_task WHERE caseid=#{caseid}")
    List<Map> queryNameFromTask(@Param("caseid") Integer caseid);

    @Select("SELECT name,id FROM  t_form")
    List<Map> queryNameFromForm();

    @Select("SELECT name,id FROM  t_formcontent")
    List<Map> queryNameFromFormContent();

    @Select("SELECT name,id FROM  t_case")
    List<Map> queryNameFromCase();

    @Select("SELECT cname,id FROM  t_layer")
    List<Map> queryNameFromLayer();

    @Select("SELECT * FROM  t_case_form WHERE formid=#{formid}")
    List<Map> queryCaseFormByFormid(@Param("formid") Integer formid);

    @Select("SELECT *,st_astext(geom) AS wkt FROM t_subtask_polygon WHERE subtaskid = #{subtaskid}")
    List<SubtaskPolygon> querySubtaskPolygonBYSubtaskId(@Param("subtaskid") Integer subtaskid);


    @Select("SELECT * FROM public.t_subtask_geom as subtask where (check_status != '已提交' OR check_status IS NULL)  and taskid=#{taskid}")
    List<SubtaskGeom> getTasks(@Param("taskid") Integer taskid);


}
